home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1996 June
/
EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso
/
earcd
/
comm1
/
qwesorcs.lha
/
qwe_sources
/
Wall
/
Wall.c
Wrap
C/C++ Source or Header
|
1995-10-03
|
5KB
|
276 lines
const char *_VERSION="\0$VER: Wall 1.01 (18.03.95)";
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <exec/ports.h>
#include <graphics/gfx.h>
#include <exec/semaphores.h>
#include <graphics/rastport.h>
#include <cnet/empty.h>
#include <cnet/cnet.h>
FILE *fp;
char line[108][83],
key[3],
linebuffer[83],
date[30];
short i,
j,
k,
l,
m,
n,
written=0,
hour=0,
min=0;
void balkenwech(void)
{
switch (j)
{
case 90:
{
PutText("76H
ÝÞ76HÝÞ");
break;
}
case 72:
{
PutText("76H
ÝÞ76HÝÞ");
break;
}
case 54:
{
PutText("76H
ÝÞ76HÝÞ");
break;
}
case 36:
{
PutText("6H
ÝÞ76HÝÞ");
break;
}
case 18:
{
PutText("6H
ÝÞ6HÝÞ");
break;
}
case 0:
{
PutText("6H
ÝÞ6HÝÞ");
break;
}
}
}
void balkenhin(void)
{
switch (j)
{
case 90:
{
PutText("76H
ÝÞ76HÝÞ");
break;
}
case 72:
{
PutText("76H
ÝÞ76HÝÞ");
break;
}
case 54:
{
PutText("76H
ÝÞ76HÝÞ");
break;
}
case 36:
{
PutText("6H
ÝÞ76HÝÞ");
break;
}
case 18:
{
PutText("6H
ÝÞ6HÝÞ");
break;
}
case 0:
{
PutText("6H
ÝÞ6HÝÞ");
break;
}
}
}
void lineprint(void)
{
k=j+18;
/* AUSGABE DES WALLTEXTES */
PutText("
H");
for (i=j;i<k;i++)
{
PutText(line[i]);
}
PutText("H");
}
main(int argc,char **argv)
{
PreMain(argc,argv); /*** Let it here, dute! ***/
/* EINLESEN DER WALL.MESS */
SetDoing("Wall");
i=0;
if (fp=fopen("pfiles:wall/wall.mess","r"))
{
while (fgets(line[i],sizeof(line[0]),fp)) i++;
fclose(fp);
}
else
goto hell;
/* AUSGABE DER WALL */
ReadFile("pfiles:wall/wall.ansi",0);
MakeDate(&z->Today,date);
date[18]=0;
hour=atoi(&date[16]);min=atoi(&date[19]);
if (date[21]=='p' && hour<12) hour+=12;
if (date[21]=='a' && hour==12) hour=0;
j=90;
lineprint();
key[0]=0;
while (key[0]!=13 && key[0]!=89 && z->TimeLeft != 0)
{
k=j+18;
key[0]=CNetGetKey();
key0:
/* RAUF UND RUNTER */
if (key[0]==27 && z->TimeLeft != 0)
{
key[0]=CNetGetKey();
if (key[0]==91)
{
key[0]=CNetGetKey();
if (key[0]==65 && j>0)
{
balkenwech();
j=j-18;
balkenhin();
lineprint();
}
if (key[0]==66 && j<90)
{
balkenwech();
j=j+18;
balkenhin();
lineprint();
}
}
else goto key0;
}
if ((z->user1.IDNumber==1) && key[0]==75)
{
key[0]=CNetGetKey();
if (key[0]>48 && key[0]<55)
{
m=(j%18+key[0]+key[0]+key[0]-49*3);
n=(j+key[0]+key[0]+key[0]-49*3);
strcpy(&line[n][17],">--------------------- ZENSIERT VOM SYSOP ----------------------\n");
strcpy(&line[n+1][12],">Grund: \n");
strcpy(&line[n+2][12],">---------------------------------------------------------------\n");
sprintf(linebuffer,"%d;1H",m+4);
PutText(linebuffer);
for(i=n;i<n+3;i++)
{
PutText(line[i]);
}
sprintf(linebuffer,"%d;18H",m+5);
PutText(linebuffer);
if (EnterLine(56,4096,""))
{
m=0;
do
{
line[n+1][m+20]=z->InBuffer[m];
m++;
}
while (z->InBuffer[m]!=0);
written=1;
}
}
}
}
if (key[0]==89)
{
balkenwech();
j=90;
balkenhin();
sprintf(line[0],"%.9s%-9.8s \n",line[87],z->user1.Handle);
sprintf(line[1],"C%2d:%02d \n",hour,min);
sprintf(line[2],"C%.6s \n",date+4);
PutText("H
");
for(i=93;i<108;i++)
{
PutText(line[i]);
}
PutText(line[0]);
PutText(line[1]);
PutText(line[2]);
/* EINGABE DES WALLTEXTES */
PutText("11H");
if (EnterLine(63,4096,""))
{
sprintf(line[0],"%.9s%-9.8s%-63s\n",line[87],z->user1.Handle,z->InBuffer);
PutText("11H");
if (EnterLine(63,4096,""))
{
sprintf(line[1],"C%2d:%02d %-63s\n",hour,min,z->InBuffer);
PutText("11H");
if (EnterLine(63,4096,""))
sprintf(line[2],"C%-9.6s%-63s\n",date+4,z->InBuffer);
}
/* SCHREIBEN DER WALL.MESS */
if (fp=fopen("pfiles:wall/wall.mess","w"))
{
for(i=3;i<108;i++)
fputs(line[i],fp);
fputs(line[0],fp);
fputs(line[1],fp);
fputs(line[2],fp);
fclose(fp);
written=0;
}
}
}
if (written==1)
{
if (fp=fopen("pfiles:wall/wall.mess","w"))
{
for(i=0;i<108;i++)
fputs(line[i],fp);
fclose(fp);
}
}
hell:
PutText("1H p");
PostMain(); /*** Must be here ***/
}